<style>
	.button-table{
		margin-top:10px;
		margin-left:26px;
	}
</style>

<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default gradient">
			<div class="panel-heading">
				<h4>
					<span>Grid History Trouble</span>
				</h4>
			</div>
			<div class="panel-body noPad clearfix">
				<table cellpadding="0" cellspacing="0" border="0" class="dynamicTable display table table-bordered" width="100%">
					<div class="button-table">
						<button type="submit" class="btn btn-info" onClick="tambah()">
							<span class="icon16 icomoon-icon-plus-circle white"></span>
							Tambah
						</button>
					</div>
					<thead>
						<tr>
							<th><center>No.</center></th>
							<th>Edit</th>
							<th>Tindak Lanjut</th>
							<th>Jenis Gangguan</th>
							<th>Tanggal & Waktu</th>
							<th>Keterangan</th>
							<th>Status</th>
						</tr>
					</thead>
					<?php
						$no=0;
						foreach($data_history_trouble as $row){
						$no++;
					?>
						<tr class="odd gradeX">
							<td><center><?php echo $no; ?></center></td>
							<td>
								<div class="controls center">
									<?php if($row["STATUS"] == 2){?>
									<a href="javascript:edit(<?php echo $row["ID_HISTORY_TROUBLE"]; ?>)" title="Edit Data" class="tip"><span class="icon14 icomoon-icon-pencil"></span></a>
									<?php }elseif($row["STATUS"] == 1){?>
									<a href="javascript:edit_alert(<?php echo $row["ID_HISTORY_TROUBLE"]; ?>)" title="Edit Data" class="tip"><span class="icon14 icomoon-icon-pencil"></span></a>
									<?php }?>
								</div>
							</td>
							<td>
								<div class="control center">
									<a href="javascript:tindak_lanjut(<?php echo $row["ID_HISTORY_TROUBLE"]; ?>)" title="Tindak Lanjuti Data" class="tip"><span class="icon14 cut-icon-popout-2"></span></a>
								</div>
							</td>
							<td><?php if($row["JENIS_GANGGUAN"] == 1){ echo "Jaringan";}elseif($row["JENIS_GANGGUAN"] == 2){ echo "Non Jaringan";}?></td>
							<td><?php echo date('d-m-Y', strtotime($row["TANGGAL"]));?><br><?php echo $row["WAKTU"]?></td>
							<td><?php echo $row["KETERANGAN"];?></td>
							<td>
								<?php if($row['STATUS'] == 1){?>
								<font color="green">Selesai</font>
								<?php }elseif($row['STATUS'] == 2){?>
								<font color="orange">Proses</font>
								<?php }?>
							</td>
						</tr>
					<?php
					}
					?>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>

<link href="<?php echo $this->config->item('plugin_path');?>tables/dataTables/jquery.dataTables.css" type="text/css" rel="stylesheet" />
<link href="<?php echo $this->config->item('plugin_path');?>tables/dataTables/TableTools.css" type="text/css" rel="stylesheet" />

<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/dataTables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/dataTables/TableTools.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/dataTables/ZeroClipboard.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/responsive-tables/responsive-tables.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('js_path');?>datatable.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>misc/nicescroll/jquery.nicescroll.min.js"></script>
<script>
function tambah(){
	document.location="<?php echo site_url("history_trouble/form_history_trouble")?>";
}
function edit(id){
	document.location="<?php echo site_url("history_trouble/form_history_trouble")?>/"+id;
}
function edit_alert(){
	alert("Data yang sudah difinalisasi tidak dapat dirubah lagi !");
}
function tindak_lanjut(id){
	document.location="<?php echo site_url("history_trouble/tindak_lanjut_trouble")?>/"+id;
}
$(document).ready(function (){
	
});
</script>